package com.bolt.support.query.toolkit;

import com.bolt.common.utils.NumberUtil;
import com.bolt.common.utils.StrUtil;
import com.bolt.support.query.calculator.domain.PivotModel;

import java.util.ArrayList;
import java.util.List;

public class PivotResult {

    public static List process(PivotModel pivotModel, List<?> result, List<String> aliases) {
        String[] pivotCols = pivotModel.getRevolveColumn();
        Integer[] pivotIndex = new Integer[pivotCols.length];
        for (int i = 0; i < pivotCols.length; i++) {
            String colValue = StrUtil.trim(pivotCols[i]);
            if (NumberUtil.isInteger(colValue)) {
                pivotIndex[i] = Integer.parseInt(colValue);
            } else {
                pivotIndex[i] = JPAUtil.findColumnIndex(aliases, colValue);
            }
        }
        List newResult = new ArrayList();


        return result;
    }
}